<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fnx" uri="http://java.sun.com/jsp/jstl/functionsx"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="f" uri="http://www.itcms.com/tags/form"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Itcms管理平台 - Powered by Itcms</title>
<jsp:include page="/WEB-INF/views/commons/head.jsp"></jsp:include>
<script type="text/javascript">
$(function() {
	$("#pagedTable").tableHighlight();
	$("#sortHead").headSort();
});
function confirmDelete() {
	return confirm("<s:message code='confirmDelete'/>");
}
function optSingle(opt) {
	if(Cms.checkeds("ids")==0) {
		alert("<s:message code='pleaseSelectRecord'/>");
		return false;
	}
	if(Cms.checkeds("ids")>1) {
		alert("<s:message code='pleaseSelectOne'/>");
		return false;
	}
	var id = $("input[name='ids']:checkbox:checked").val();
	location.href=$(opt+id).attr("href");
}
function optDelete(form) {
	if(Cms.checkeds("ids")==0) {
		alert("<s:message code='pleaseSelectRecord'/>");
		return false;
	}
	if(!confirmDelete()) {
		return false;
	}
	form.action='delete.do';
	form.submit();
	return true;
}
</script>
</head>
<body class="c-body">
<jsp:include page="/WEB-INF/views/commons/show_message.jsp"/>
<div class="c-bar margin-top5">
  <span class="c-position"><s:message code="company.management"/> - <s:message code="list"/></span>
	<span class="c-total">(<s:message code="totalElements" arguments="${pagedList.totalElements}"/>)</span>
</div>
<form action="list.do" method="get">
	<fieldset class="c-fieldset">
    <legend><s:message code="search"/></legend>
	  <label class="c-lab">公司名称: <input type="text" name="search_CONTAIN_CName" value="${search_CONTAIN_CName[0]}"/></label>
<%-- 	  <label class="c-lab">站点: <input type="text" name="search_EQ_companySite.siteId" value="${requestScope['search_CONTAIN_companySite.siteId'][0]}"/></label> --%>
	  <label class="c-lab"><input type="submit" value="<s:message code="search"/>"/></label>
  </fieldset>
</form>
<form method="post">
<tags:search_params/>
<div class="ls-bc-opt">
	<shiro:hasPermission name="plug:company:create">
	<div class="ls-btn"><input type="button" value="查看全部部门" onclick="location.href='list.do';"/></div>
	<div class="ls-btn"></div>
	</shiro:hasPermission>
	
	<shiro:hasPermission name="plug:company:create">
	<%-- <div class="ls-btn"><input type="button" value="<s:message code="create"/>" onclick="location.href='create.do?${searchstring}';"/></div> --%>
	<div class="ls-btn"><input type="button" value="新增公司" onclick="location.href='create.do?${searchstring}';"/></div>
	<div class="ls-btn"></div>
	</shiro:hasPermission>
	
	<shiro:hasPermission name="plug:company:create">
	<div class="ls-btn"><input type="button" value="添加部门" onclick="location.href='../department/create.do?${searchstring}';"/></div>
	<div class="ls-btn"></div>
	</shiro:hasPermission>
	<shiro:hasPermission name="plug:company:delete">
		<div class="ls-btn"><input type="button" value="<s:message code="delete"/>" onclick="return optDelete(this.form);"/></div>
      </shiro:hasPermission>
	<%-- <shiro:hasPermission name="plug:company:copy">
	<div class="ls-btn"><input type="button" value="<s:message code="copy"/>" onclick="return optSingle('#copy_opt_');"/></div>
	</shiro:hasPermission>
	<shiro:hasPermission name="plug:company:edit">
	<div class="ls-btn"><input type="button" value="<s:message code="edit"/>" onclick="return optSingle('#edit_opt_');"/></div>
	</shiro:hasPermission>
	<shiro:hasPermission name="plug:company:delete">
	<div class="ls-btn"><input type="button" value="<s:message code="delete"/>" onclick="return optDelete(this.form);"/></div>
	</shiro:hasPermission> --%>
	<div style="clear:both"></div>
</div>
<table id="pagedTable" border="0" cellpadding="0" cellspacing="0" class="ls-tb margin-top5">
  <thead id="sortHead" pagesort="<c:out value='${page_sort[0]}' />" pagedir="${page_sort_dir[0]}" pageurl="list.do?page_sort={0}&page_sort_dir={1}&${searchstringnosort}">
  <tr class="ls_table_th">
    <th width="25"><input type="checkbox" onclick="Cms.check('ids',this.checked);"/></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="name">公司名称</span></th>
    <th class="ls-th-sort"><span class="ls-sort" pagesort="CCreatetime">创建时间</span></th>
    <th width="110"><s:message code="operate"/></th>
   <%--  <th width="30" class="ls-th-sort"><span class="ls-sort" pagesort="id">ID</span></th> --%>
<%--     <th class="ls-th-sort"><span class="ls-sort" pagesort="CCreatetime">创建时间</span></th> --%>
    
  </tr>
  </thead>
  <tbody>
  <c:forEach var="bean" varStatus="status" items="${pagedList.content}">
  <tr<shiro:hasPermission name="plug:company:edit"> ondblclick="location.href=$('#edit_opt_${bean.id}').attr('href');"</shiro:hasPermission>/>
    <td><input type="checkbox" name="ids" value="${bean.id}"/></td>
    <td><c:out value="${bean.CName}"/></td>
    <td><c:out value="${bean.CCreatetime}"/></td>
    <td align="center" nowrap="nowrap">
			<%-- <shiro:hasPermission name="plug:company:copy">
      <a id="copy_opt_${bean.id}" href="create.do?id=${bean.id}&${searchstring}" class="ls-opt"><s:message code="copy"/></a>
      </shiro:hasPermission> --%>
			<shiro:hasPermission name="plug:company:edit">
      <a id="edit_opt_${bean.id}" href="edit.do?id=${bean.id}&position=${pagedList.number*pagedList.size+status.index}&${searchstring}" class="ls-opt">编辑</a>
      </shiro:hasPermission>
      <shiro:hasPermission name="plug:department:create">
      <a href="../department/create.do?companyId=${bean.id}&${searchstring}" class="ls-opt">添加部门</a>
	</shiro:hasPermission>
      <shiro:hasPermission name="plug:department:list">
      <a href="../department/list.do?search_EQ_company.CCompanyid=${bean.CCompanyid}" class="ls-opt">所属部门</a>
	</shiro:hasPermission>
      <shiro:hasPermission name="plug:employee:list">
      <a href="../employee/list.do?search_EQ_applyJobInfo.department.company.CCompanyid=${bean.CCompanyid}&returnType=companyList" class="ls-opt">所属简历</a>
	</shiro:hasPermission>
    </td>
   <%--  <td><c:out value="${bean.id}"/></td> --%>
<%--     <td><c:out value="${bean.CCreatetime}"/></td> --%>
<%--     <td align="center"><fmt:formatDate value="${bean.creationDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td> --%>
<%--     <td align="center"><fmt:formatDate value="${bean.CCreatetime}" pattern="yyyy-MM-dd"/></td> --%>
  </tr>
  </c:forEach>
  </tbody>
</table>
<c:if test="${fn:length(pagedList.content) le 0}"> 
<div class="ls-norecord margin-top5"><s:message code="recordNotFound"/></div>
</c:if>
</form>
<form action="list.do" method="get" class="ls-page">
	<tags:search_params excludePage="true"/>
  <tags:pagination pagedList="${pagedList}"/>
</form>
</body>
</html>